package com.mi.million;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * 启动类
 */
@Slf4j
@MapperScan(basePackages = {"com.mi.rule.db.mapper", "com.mi.million.**.mapper"})
@SpringBootApplication(scanBasePackages = {"com.mi.rule", "com.mi.million"})
public class Start {
    public static void main(String[] args) throws Exception {
        SpringApplication.run(Start.class, args);
    }
}

// IP V4
//        String ip = "106.41.69.25";
//        // IP V6 也是可以的
//        DatabaseReader reader = null;
//        String path = "C:\\Users\\Administrator\\Desktop\\GeoLite2-City_20200421\\GeoLite2-City_20200421\\GeoLite2-City.mmdb";
//        File database = new File(path);
//
//        // 读取数据库内容
//        reader = new DatabaseReader.Builder(database).build();
//        InetAddress ipAddress = InetAddress.getByName(ip);
//        IspResponse isp = reader.isp(ipAddress);
//        EnterpriseResponse response1 = reader.enterprise(ipAddress);
//        DomainResponse response2 = reader.domain(ipAddress);

//        ConnectionTypeResponse response = reader.connectionType(ipAddress);
//        ConnectionTypeResponse.ConnectionType type = response.getConnectionType();

//        AnonymousIpResponse response3 = reader.anonymousIp(ipAddress);

//        CityResponse response4 = reader.city(ipAddress);

//        System.out.println(response4); // true

//
//        while (true) {
//                log.error("        // IP V4\n" +
//                "//        String ip = \"106.41.69.25\";\n" +
//                "//        // IP V6 也是可以的\n" +
//                "//        DatabaseReader reader = null;\n" +
//                "//        String path = \"C:\\\\Users\\\\Administrator\\\\Desktop\\\\GeoLite2-City_20200421\\\\GeoLite2-City_20200421\\\\GeoLite2-City.mmdb\";\n" +
//                "//        File database = new File(path);\n" +
//                "//\n" +
//                "//        // 读取数据库内容\n" +
//                "//        reader = new DatabaseReader.Builder(database).build();\n" +
//                "//        InetAddress ipAddress = InetAddress.getByName(ip);\n" +
//                "//        IspResponse isp = reader.isp(ipAddress);\n" +
//                "//        EnterpriseResponse response1 = reader.enterprise(ipAddress);\n" +
//                "//        DomainResponse response2 = reader.domain(ipAddress);\n" +
//                "\n" +
//                "//        ConnectionTypeResponse response = reader.connectionType(ipAddress);\n" +
//                "//        ConnectionTypeResponse.ConnectionType type = response.getConnectionType();\n" +
//                "\n" +
//                "//        AnonymousIpResponse response3 = reader.anonymousIp(ipAddress);\n" +
//                "\n" +
//                "//        CityResponse response4 = reader.city(ipAddress);\n" +
//                "\n" +
//                "//        System.out.println(response4); // true");
//                }